#include<stdio.h>
#include"mystdio.h"
#include<string.h>
#include<unistd.h>


void testForFlushLine()
{

    myFILE* fp = myFileOpen("./line.txt", "w");
    int count = 5;
    // 这里因为有\n会不断地打印
    const char* message = "Pring line log\n";
    while(count--)
    {
        myFileWrite(message, strlen(message), fp);
        sleep(2);
    }
    myFileClose(fp);
}
void testForFlushAll()
{
    myFILE* fp = myFileOpen("./all.txt", "w");
    int count = 5;
    // 注意这里没有\n代表着等待进程退出，在打印
    const char* message = "Print ALL log";
    while(count--)
    {
        myFileWrite(message, strlen(message), fp);
        sleep(2);
    }
    myFileClose(fp);
}

int main()
{
    
    testForFlushLine();
    // testForFlushAll();
}
